var express = require('express');
var router = express.Router();

var utils_fs = require("../routes/imagecloud");


/*
get file
 */

router.get('/linkingois/api/v1/structure/ROIPlane',function (req,res,next) {
  var _params = req.query;
  // if(_params.fileName === undefined)
  var _filename = _params.fileName === undefined ?  _params.patientId+"/"+_params.studyUID+"/structuresetsList" :
  _params.patientId+"/"+_params.studyUID+"/RTSTRUCT/ROIPLANE/"+_params.fileName;

  utils_fs.getJsonFileData(_filename,function (data) {
     var result = {
       data:data
     };
    res.status(200).json(result);
  });
})


router.get('/linkingois/api/v1/structure/dosegridframe',function (req,res,next) {
  var _params = req.query;
  var _filename = _params.fileName === undefined ?  _params.patientId+"/"+_params.studyUID+"/doseGridFrameList" :
  _params.patientId+"/"+_params.studyUID+"/RTDOSE/DOSEGRIDFRAME/"+_params.fileName;
  utils_fs.getJsonFileData(_filename,function (data) {
    var result = {
      data:data
    };
    console.log(data.position);
    res.status(200).json(result);
  });
})
module.exports = router;
